//package com.fenghen.jdbctempleplus.builder;
//
//import com.fenghen.jdbctempleplus.support.Condition;
//import com.fenghen.jdbctempleplus.support.EntityMeta;
//import com.fenghen.jdbctempleplus.support.EntityParser;
//import com.fenghen.jdbctempleplus.support.SqlBuilder;
//import org.springframework.jdbc.core.JdbcTemplate;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
//public class DeleteBuilder {
//    private final Class<?> entityClass;
//    private final JdbcTemplate jdbcTemplate;
//    private final EntityParser entityParser;
//    private final List<Condition> conditions = new ArrayList<>();
//
//    public DeleteBuilder(Class<?> entityClass, JdbcTemplate jdbcTemplate, EntityParser entityParser) {
//        this.entityClass = entityClass;
//        this.jdbcTemplate = jdbcTemplate;
//        this.entityParser = entityParser;
//    }
//
//    public DeleteBuilder where(String condition, Object... params) {
//        conditions.add(new Condition(condition, params));
//        return this;
//    }
//
//    public int execute() {
//        EntityMeta meta = entityParser.parse(entityClass);
//        String sql = SqlBuilder.buildDeleteSql(meta, conditions);
//        return jdbcTemplate.update(sql, conditions.stream()
//                .flatMap(c -> Arrays.stream(c.getParams()))
//                .toArray());
//    }
//}